package com.plusapps.inkwang.model;

public class Video {

    /**
    *
    *   <video>
		    <id>25612105</id>
		    <title>[6월 26일 오전예배] 설교: 어디에 속했습니까</title>
		    <description>2011년 6월 26일 오전예배&lt;br /&gt;&lt;br /&gt;설교: 정순재 목사님</description>
		    <url>http://vimeo.com/25612105</url>
		    <upload_date>2011-06-25 23:58:53</upload_date>
		    <mobile_url>http://vimeo.com/m/#/25612105</mobile_url>
		    <thumbnail_small>http://b.vimeocdn.com/ts/168/747/168747411_100.jpg</thumbnail_small>
		    <thumbnail_medium>http://b.vimeocdn.com/ts/168/747/168747411_200.jpg</thumbnail_medium>
		    <thumbnail_large>http://b.vimeocdn.com/ts/168/747/168747411_640.jpg</thumbnail_large>
		    <user_name>Inkwang church</user_name>
		    <user_url>http://vimeo.com/inkwang</user_url>
		    <user_portrait_small>http://b.vimeocdn.com/ps/221/314/2213143_30.jpg</user_portrait_small>
		    <user_portrait_medium>http://b.vimeocdn.com/ps/221/314/2213143_75.jpg</user_portrait_medium>
		    <user_portrait_large>http://b.vimeocdn.com/ps/221/314/2213143_100.jpg</user_portrait_large>
		    <user_portrait_huge>http://b.vimeocdn.com/ps/221/314/2213143_300.jpg</user_portrait_huge>
		    <stats_number_of_likes>0</stats_number_of_likes>
		    <stats_number_of_plays>2</stats_number_of_plays>
		    <stats_number_of_comments>0</stats_number_of_comments>
		    <duration>1844</duration>
		    <width>640</width>
		    <height>480</height>
		    <tags>인광교회, 설교</tags>
		    <embed_privacy>anywhere</embed_privacy>
		  </video>
    */

	
	private String vid;
	private String title;
	
	/*
	private String desc;
	*/
	
	private String url;
	/*
	private String uploadDate;
	*/
	
	private String thumbnailURL;
	/*
	private String userName;
	private String tags;
	*/
	private int likesCount;
	private int playsCount;
	private int commentsCount;

	private int duration;


	
	public void setVid (String _id) {
		vid = _id;
	}
	public String getVid () {
		return vid;
	}
	
	public void setTitle (String _title) {
		title = _title;
	}
	public String getTitle () {
		return title;
	}
	
	public void setURL (String _url) {
		url = _url;
	}
	public String getURL () {
		return url;
	}
	
	public void setThumbnailURL (String _url) {
		thumbnailURL = _url;
	}
	public String getThumbnailURL () {
		return thumbnailURL;
	}
	
	public void setDuration (int _duration) {
		duration = _duration;
	}
	public int getDuration () {
		return duration;
	}
	public String getDurationWithFormat () {
		int hours = 0;
		int minutes = 0;
		int seconds = 0;
		int rest = duration;
		
		hours = rest / (60 * 60);
		if (hours > 0) {
			rest %= (60 * 60);
		}
		
		minutes = rest / 60;
		if (minutes > 0) {
			rest %= 60;
		}
		
		seconds = rest;
		
		if (hours == 0) return String.format("%d분 %d초", minutes, seconds);
		else return String.format("%d시간 %d분 %d초", hours, minutes, seconds);
	}
	
	public void setLikesCount (int _count) {
		likesCount = _count;
	}
	public int getLikesCount () {
		return likesCount;
	}
	
	public void setPlaysCount (int _count) {
		playsCount = _count;
	}
	public int getPlaysCount () {
		return playsCount;
	}
	
	public void setCommentsCount (int _count) {
		commentsCount = _count;
	}
	public int getCommentsCount () {
		return commentsCount;
	}
	
	public String getVideoDesc () {
		return getDurationWithFormat();
	}
	
	public String getVideoStats () {
		return String.format("Plays: %d   Likes: %d   Comments: %d", playsCount, likesCount, commentsCount);
	}
	
	public String toString () {
		return getTitle();
	}


}
